home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / QuickDraw 3D / Samples / SampleCode / VCDemo / Source / ErrMsg.c next >
Encoding:
C/C++ Source or Header  |  1997-08-14  |  1.3 KB  |  67 lines  |  [TEXT/MPCC]

  1. /*
  2.     This contains code for handling an error dialog box.
  3.     
  4.     If you want to display an error code and string, call ErrMsgCode,
  5.     otherwise, for string only, just call ErrMsg.
  6.     --------------------------
  7.     9-30-92  • Brigham Stevens
  8. */
  9.  
  10. #include <Types.h>
  11. #include <LowMem.h>
  12. #include <TextUtils.h>
  13. #include <Dialogs.h>
  14. #include <SegLoad.h>
  15.  
  16. #define KEEP_GOING 1
  17. #define DEBUGGER 2
  18. #define EXITTOSHELL 3
  19.  
  20. //MW Added prototypes
  21. void ErrMsgCode(Str255 msg, short code);
  22. void ErrMsg(Str255 msg);
  23.  
  24. void ErrMsgCode(Str255 msg, short code)
  25. /*
  26.     Display the error alert with
  27.     an error code.
  28.     
  29.     This handy alert will also display 
  30.     memerr and reserr for you.
  31. */
  32.     Str31    codeStr;
  33.     Str31    memErrStr;
  34.     Str31    resErrStr;
  35.     short    disposition;
  36.     
  37.     NumToString(code,codeStr);
  38. //    MW Changed the MemErr and ResErr lowmemory globals to use LMGet..Err accessor functions
  39.     NumToString(LMGetMemErr(),memErrStr);
  40.     NumToString(LMGetResErr(),resErrStr);
  41.     
  42.     ParamText(msg, codeStr, memErrStr, resErrStr);
  43.  
  44.     disposition = Alert(128, nil);
  45.     
  46.     switch(disposition)
  47.     {
  48.         case    KEEP_GOING:        return;
  49.                                 break;
  50.         case    DEBUGGER:        DebugStr("\p Doing a Stack Crawl;sc6");
  51.                                 break;
  52.         case    EXITTOSHELL:    ExitToShell();
  53.                                 break;
  54.     }
  55. }
  56.  
  57.  
  58. void ErrMsg(Str255 msg)
  59. /*
  60.     No error code desired.
  61. */
  62. {
  63.     ErrMsgCode(msg, 0);
  64. }
  65.  
  66.